---
layout: m1x_soap
title: Catalog Product Attribute Media
---

<h2><a name="MAPI-ProductImages-Module%3AMageCatalog"></a>Module: Mage_Catalog</h2>

<p>The Mage_Catalog module allows you to manage categories and products.</p>

<h4><a name="MAPI-ProductImages-ProductImages"></a>Product Images</h4>

<p>Allows you to manage product images.</p>

<p><b>Resource Name</b>: catalog_product_attribute_media</p>

<p><b>Aliases</b>:</p>
<ul>
	<li>product_attribute_media</li>
	<li>product_media</li>
</ul>


<p><b>Methods</b>:</p>
<ul>
	<li><a href="catalog_product_attribute_media.currentStore.html" title="catalog_product_attribute_media.currentStore">catalog_product_attribute_media.currentStore</a> &#45; Set/Get the current store view</li>
	<li><a href="catalog_product_attribute_media.list.html" title="catalog_product_attribute_media.list">catalog_product_attribute_media.list</a> &#45; Retrieve the product images</li>
	<li><a href="catalog_product_attribute_media.info.html" title="catalog_product_attribute_media.info">catalog_product_attribute_media.info</a> &#45; Retrieve the specified product image</li>
	<li><a href="catalog_product_attribute_media.types.html" title="catalog_product_attribute_media.types">catalog_product_attribute_media.types</a> &#45; Retrieve product image types</li>
	<li><a href="catalog_product_attribute_media.create.html" title="catalog_product_attribute_media.create">catalog_product_attribute_media.create</a> &#45; Upload a new image for a product</li>
	<li><a href="catalog_product_attribute_media.update.html" title="catalog_product_attribute_media.update">catalog_product_attribute_media.update</a> &#45; Update an image for a product</li>
	<li><a href="catalog_product_attribute_media.remove.html" title="catalog_product_attribute_media.remove">catalog_product_attribute_media.remove</a> &#45; Remove an image for a product</li>
</ul>


<h4><a name="MAPI-ProductImages-Faults"></a>Faults</h4>


<table><tbody>
<tr>
<th> Fault Code </th>
<th> Fault Message </th>
</tr>
<tr>
<td> 100 </td>
<td> Requested store view not found. </td>
</tr>
<tr>
<td> 101 </td>
<td> Product not exists. </td>
</tr>
<tr>
<td> 102 </td>
<td> Invalid data given. Details in error message. </td>
</tr>
<tr>
<td> 103 </td>
<td> Requested image not exists in product images’ gallery. </td>
</tr>
<tr>
<td> 104 </td>
<td> Image creation failed. Details in error message. </td>
</tr>
<tr>
<td> 105 </td>
<td> Image not updated. Details in error message. </td>
</tr>
<tr>
<td> 106 </td>
<td> Image not removed. Details in error message. </td>
</tr>
<tr>
<td> 107 </td>
<td> Requested product doesn’t support images </td>
</tr>
</tbody></table>


<h4><a name="MAPI-ProductImages-Examples"></a>Examples</h4>

<h5><a name="MAPI-ProductImages-Example1.Workingwithproductimages"></a>Example 1. Working with product images</h5>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: java; gutter: false">$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy-&gt;login('apiUser', 'apiKey');

$newImage = array(
    'file' =&gt; array(
        'name' =&gt; 'file_name',
        'content' =&gt; base64_encode(file_get_contents('product.jpg')),
        'mime'    =&gt; 'image/jpeg'
    ),
    'label'    =&gt; 'Cool Image Through Soap',
    'position' =&gt; 2,
    'types'    =&gt; array('small_image'),
    'exclude'  =&gt; 0
);

$imageFilename = $proxy-&gt;call($sessionId, 'product_media.create', array('Sku', $newImage));


var_dump($imageFilename);

// Newly created image file
var_dump($proxy-&gt;call($sessionId, 'product_media.list', 'Sku'));

$proxy-&gt;call($sessionId, 'product_media.update', array(
    'Sku',
    $imageFilename,
    array('position' =&gt; 2, 'types' =&gt; array('image') /* Lets do it main image for product */)
));

// Updated image file
var_dump($proxy-&gt;call($sessionId, 'product_media.list', 'Sku'));

// Remove image file
$proxy-&gt;call($sessionId, 'product_media.remove', array('Sku', $imageFilename));

// Images without our file
var_dump($proxy-&gt;call($sessionId, 'product_media.list', 'Sku'));</pre>
		</div>
</div></div>

				    
Create the Magento file system owner                   			    
